<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function test(str){
            var str1 = str.split("")
            for(var i=1; i<str1.length;i++)
            {
                if(str1[i]>="A"&&str1[i]<="Z")
                {
                    str1[i] = str1[i].toLowerCase();
                    str1.splice(i,0," ")
                }
                
            }
            return str1.join("")
        }

        var arr = "HowAreYou"
        var olo = test(arr)
        console.log(olo)
    </script>
</head>
<body>
    
</body>
</html>